package com.yanqu.road.entity.activity.foxcard.config;

import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.string.StringUtils;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

@FieldTypeAnnotation(tableName = "t_s_activity_fox_chapter")
public class FoxCardChapterConfig {
    @FieldTypeAnnotation(select = true, orderASC = true, isIndex = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "章节id", isIndex = true)
    private int id;
    @FieldTypeAnnotation(desc = "类型")
    private int type;
    @FieldTypeAnnotation(desc = "参数")
    private String param;
    @FieldTypeAnnotation(desc = "章节名称")
    private String name;
    @FieldTypeAnnotation(desc = "章节描述")
    private String desc;
    @FieldTypeAnnotation(desc = "苦情树等级限制")
    private int treeLimit;
    @FieldTypeAnnotation(desc = "地区描述")
    private String placeDesc;
    @FieldTypeAnnotation(desc = "效果表现参数")
    private String showParams;

    //    额外出牌次数|额外弃牌次数|额外金币|额外的小丑牌数量|额外的出牌次数
    private List<Integer> params = new ArrayList<>();

    public FoxCardChapterConfig(ResultSet rs) throws SQLException {
        this.activityId = rs.getInt("activityId");
        this.id = rs.getInt("id");
        this.type = rs.getInt("type");
        this.param = rs.getString("param");
        this.name = rs.getString("name");
        this.desc = rs.getString("desc");
        this.treeLimit = rs.getInt("treeLimit");
        this.placeDesc = rs.getString("placeDesc");
        this.showParams = rs.getString("showParams");

        this.params = StringUtils.stringToIntegerList(param, "\\|");
    }

    public int getActivityId() {
        return activityId;
    }

    public int getId() {
        return id;
    }

    public int getType() {
        return type;
    }

    public String getParam() {
        return param;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    public int getTreeLimit() {
        return treeLimit;
    }

    public List<Integer> getParams() {
        return params;
    }

    //    额外出牌次数|额外弃牌次数|额外金币|额外的小丑牌数量现在
    public int getShowTimesAdd() {
        return params.get(0);
    }

    public int getDropTimesAdd() {
        return params.get(1);
    }

    public int getGoldAdd() {
        return params.get(2);
    }

    public int getEffectCardLimitAdd() {
        return params.get(3);
    }

    public String getPlaceDesc() {
        return placeDesc;
    }

    public String getShowParams() {
        return showParams;
    }
}